<template>
    <div class="delivery-tabs">
        <div class="tab-item" :class="{ active: currentTab === 'delivery' }" @click="handleTab('delivery')">
            快递配送
        </div>
        <div class="tab-item" :class="{ active: currentTab === 'pickup' }" @click="handleTab('pickup')">
            到店自取
        </div>
    </div>
</template>

<script setup>
import { ref, defineEmits } from 'vue';

const emit = defineEmits(['tab-change']);
const currentTab = ref('delivery');

const handleTab = (tab) => {
    currentTab.value = tab;
    emit('tab-change', tab);
};
</script>

<style scoped>
.delivery-tabs {
    display: flex;
    border-bottom: 1px solid #f5f5f5;
}

.tab-item {
    flex: 1;
    text-align: center;
    padding: 14px 0;
    font-size: 16px;
    color: #666;
    cursor: pointer;
    position: relative;
}

.tab-item.active {
    color: #ee0a24;
    font-weight: 500;
}

.tab-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: #ee0a24;
}
</style>